package com.logistics.qrcode.entity.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.logistics.map.entity.model.MapComponentsSave;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 *
 * </p>
 *
 * @author zhiyu.fan
 * @since 2024-07-05
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("lgs_qrcode")
public class Qrcode implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    private Integer type;

    private String code;

    private String name;

    private String value;

    private String area;

    private String zone;

    public Qrcode() {}

    public Qrcode(MapComponentsSave save){
        this.code = save.getLabel();
        this.name = save.getName();
        this.value = save.getLocation();
        this.zone = save.getZone();
        this.area = save.getLocationArea();
    }

    public static Qrcode build(MapComponentsSave save) {
        return new Qrcode(save);
    }
}
